package com.java2302.manufacturing.exception;

import com.java2302.manufacturing.vo.ResultVo;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.nio.file.AccessDeniedException;

@RestControllerAdvice
public class MyExceptionHandle {
    @ExceptionHandler(value = AccessDeniedException.class)
    public ResultVo handleAccessException(AccessDeniedException e){
        return ResultVo.fail(e.getMessage(),null);
    }
    @ExceptionHandler(value = RuntimeException.class)
    public ResultVo handleException(RuntimeException e) {
        return ResultVo.fail(e.getMessage(),null);
    }
}